<!doctype html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>Simple Examples</title>
		<style>
			form {
				margin: 0;
			}
			textarea {
				display: block;
			}
		</style>
		<script charset="utf-8" src="../kindeditor.js"></script>
		<script charset="utf-8" src="../lang/zh_CN.js"></script>
		<script charset="utf-8" src="../jquery-1.7.1.min.js"></script>
		<script>
			
			$(function(){
				var editor;
				var top;
				var height=500;
				KindEditor.ready(function(K) {
					editor = K.create('textarea[name="content"]', {
						resizeType : 0,
						width:1000,
						height:500,
						allowPreviewEmoticons : false,
						allowImageUpload : false,
						items : [
							'paste','|','copy','|', 'redo','|', 'fontname', 'fontsize','|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull',
							'link','|', 'multiimage','|', 'emoticons','|', 'emoticons','|', 'quickformat','|', 'fullscreen',
							'cut','undo','|', 'bold','|', 'italic', 'underline', 'forecolor', 'hilitecolor', 'strikethrough', 'lineheight','|',
							'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'table']
					});
					K('#blogtitle').click(function(){
						K(this).removeClass('ke-title-bg');
					});
					K('#blogtitle').blur(function(){
						var title=K(this);
						if(title.val()==''){
							K(this).addClass('ke-title-bg');
						}
					});
					top=$('.ke-toolbar').offset().top; 
					//console.log(K('#ke-edit-iframe').document);
					$('.ke-edit-iframe').contents().keyup(function(){ 
						var ifheight=$(this).height();
						if(ifheight!=height){
							$('.ke-edit-iframe').height(ifheight);
							height=ifheight;
						}
					})
				});
				
				$(document).scroll(function(){
					if($('body').scrollTop()>=top){
						$('.ke-toolbar').addClass('toolbar-fixed');
					}else{
						$('.ke-toolbar').removeClass('toolbar-fixed');
					}
				});
				
			})
		</script>
	</head>
	<body>
		<h3>测试</h3>
		<div class="editor-wrapper">
			<form>
				<textarea name="content" style="width:700px;height:200px;visibility:hidden;">KindEditor</textarea>
				<div class="editor-meta">
					<div class="editor-share">
						分享
					</div>
					<div class="editor-cat">
						分类
					</div>
					<div class="editor-btn">
						提交
					</div>
				</div>
			</form>
		</div>
	</body>
</html>
